FROM node:12 as build
WORKDIR /app
COPY .npmrc package.json yarn.lock ./
RUN yarn install

COPY . .
RUN npm run build

FROM nginx:stable-alpine

ARG GIT_COMMIT=unspecified
ENV VERSION=${GIT_COMMIT}

COPY --from=build /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf

CMD ["nginx", "-g", "daemon off;"]
